<template>
  <el-upload
    :headers="headers"
    :action="updateAvatarApi"
    :limit="1"
    :on-success="uploadSuccess"
    multiple>
    <el-button size="small" type="primary">点击上传</el-button>
  </el-upload>
</template>

<script>
import { getToken } from '@/utils/auth'
import { mapGetters } from 'vuex'
export default {
  name: 'ValiUpload',
  data() {
    return {
      headers: {
        Token: getToken()
      }
    }
  },
  computed: {
    ...mapGetters(['user', 'updateAvatarApi', 'baseApi'])
  },
  methods: {
    uploadSuccess(response) {
      this.$emit('changeValied', this.formItem)
    }
  }
}
</script>

<style scoped lang="scss"></style>
